/**
 * @param {string} s
 * @return {string[]}
 */
export var letterCasePermutation = function (s) {
  const ans = ['']
  for (let i = 0; i < s.length; i++) {
    const c = s[i]
    if (c.charCodeAt() >= 65) {
      const n = ans.length
      for (let j = 0; j < n; j++) {
        ans.push(ans[j] + c.toUpperCase())
        ans[j] += c.toLowerCase()
      }
    } else {
      for (let j = 0; j < ans.length; j++) {
        ans[j] += c
      }
    }
  }
  return ans
}
